<?php echo $header; ?><?php echo $column_left; ?><?php echo $column_right; ?>
<div id="content">
<div class="main clearfix">
<?php if($parent_id == 0): ?>
<div class="box_main_top clearfix">  
  
  <div class="main_img clearfix">
  	<ul>
    	<li class="list_items">
        	<h2><a style="<?php echo 'color:'.$color;?>"><?php echo $heading_title; ?></a></h2>
        	<?php if ($thumb) { ?>
		    	<div class="image"><img src="<?php echo $thumb; ?>" /></div>
		    <?php } ?>   	
        </li>                               
    </ul>                                               
  </div>  
  <?php if($categories):?>
   <div class="main_category  clearfix">
   	<div class="scroll-pane">
    	<div class="with_109" id="width_items">
    	<?php $index=0; foreach($categories as $cate):?>      	
    	<?php if($index % 4 == 0):?>  	
        	<div class="box_items_fix clearfix">
         <?php endif;?>
         <div class="item_main_category">
              <h2><a style="<?php echo 'color:'.$color;?>" href="<?php echo $cate['href']?>"><?php echo $cate['heading_title']; ?></a></h2>
              <a href="<?php echo $cate['href']?>" class="img_item_main_category"><img width="217px" height="158px" src="<?php echo $cate['thumb']; ?>" alt="" title="" /></a>
       	 </div><!--end  item_main_category-->                                    
        <?php if($index % 3 == 0 && $index != 0 || $index == (count($categories) - 1)):?>  	   
        	</div><!--end box_items_fix-->
        <?php endif;$index++;?> 
          <?php endforeach;?>                                                                                                                 
         </div>
     </div>
    </div><!--end main_category-->  
    <?php endif;?>      
     
  </div>
  
  <div class="dangkyphieugiamgia">
       <a href="javascript:void(0)" class="click_coupon"><img src="../image/data/dangkynhan_giamgia.png" alt="" title="" /></a>
       <?php echo $content_top; ?>                        
   </div>	
  
  
  	<?php if ($products) { ?>      
  
  	<div class="box_center box_product clearfix">
		<div class="title">
			<a style="<?php echo 'color:'.$color;?>" href="#">Bộ sưu tập</a>
		</div>					
		<div class="content clearfix" id="tabs-1">
        	<div class="scroll-pane_1">                           
            	<div class="width_items_1">
                            <?php foreach($products as $product):?>
                            <?php if($product['collection'] == 1):?>
								<div class="items clearfix">                                	
                                    <label class="img_items clearfix">
                                    <a href="<?php echo $product['href']?>"><img src="<?php echo $product['thumb']; ?>" width="158" height="118" /></a>
                                    </label>
                                    <?php if($product['special'] && $product['price'] != 0 && $product['price'] > $product['special']):?>
                                    <span class="icon_down"><span class="text_ration"><?php echo ceil((($product['price']-$product['special'])/$product['price'])*100)."%";?></span></span>
                                    <?php endif;?>
                                	<h3><a style="<?php echo 'color:'.$color;?>" href="<?php echo $product['href']?>" class="name_items">BST <?php echo $heading_title;?> <br />
                                	<small><?php echo $product['short_description']?></small></a></h3>													
									<?php if (!$product['special']):?>
                                		<span class="sp_price"><?php echo $product['price']?></span>
                                	<?php else:?>
                                		<span class="sp_price_off "><?php echo $product['price'];?></span>
										<span class="sp_price"><?php echo $product['special']?></span>
                                	<?php endif;?>																	
                                    <h2 class="danhmuc_sp"><a href="#"><?php echo $product['name']?></a></h2>																	
								</div><!--end items-->
							<?php endif;?>	
							<?php endforeach;?>	
            	</div><!--end with200em-->
        	</div><!--END CONTENT-->														
	 	</div>
  	</div><!--end box_product-->   
  
  	<div class="box_center box_product clearfix">
		<div class="title">
			<a style="<?php echo 'color:'.$color;?>" href="#">Các sản phẩm khác</a>
		</div>					
		<div class="content clearfix" id="tabs-1">
        	<div class="scroll-pane_2">                                                       
            <div class="with_109 width_items_2">
            <?php $index=0; foreach($products as $product):?>
            <?php if($product['collection'] == 0):?> 
            <?php if($index % 2 == 0):?>                                           						
            	<div class="items_two">	
            <?php endif;?>                							
            	<div class="items_sp clearfix">
                	<h3 class="name_items_items_sp"><a style="<?php echo 'color:'.$color;?>" href="<?php echo $product['href']; ?>"><?php echo $product['name']?></a></h3>		
                    <a href="<?php echo $product['href']; ?>" class="img_items clearfix"><img src="<?php echo $product['thumb']; ?>" width="158" height="121" /></a>
                </div><!--end items-->                                
             <?php if($index != 0 && $index %2 ==1 || $index == count($products) -1):?>                   
             	</div><!--end items_two-->
             <?php endif;$index++;?>            
             <?php endif;?>                                   															
			<?php endforeach;?>					
             </div><!--end with109-->                         
             </div>                         
        </div><!--END CONTENT-->															
					
	</div><!--end cac san pham khac-->	
    
  <?php } ?>
  <?php if (!$categories && !$products) { ?>
  <div class="content"><?php echo $text_empty; ?></div>  
  <?php } ?>   
  <?php echo $content_bottom; ?> 
  
  <?php else:?><!-- parent_id != 0 -->    
	<?php echo $content_top; ?>
	  <div class="path_way left">
	  	<?php foreach ($breadcrumbs as $breadcrumb): ?>
	  	<?php if($breadcrumb['parent_id'] == 0):?>
	  	<a  href="<?php echo $breadcrumb['href'];?>"><?php echo $breadcrumb['text']?></a> 
	  	<?php else:?>
	  	<a style="<?php echo 'color:'.$color;?>" class="sub_path_way curent"><?php echo $breadcrumb['text']?></a>
	  	<?php endif;?>
	  	<?php endforeach;?>	  	
	  </div>
	  
	  <div class="fix_position">
      	<div id="slider">
                            <ul>				
                                <li><a href="#"><img src="../image/data/images_1.jpg" width="938" height="209" alt="Css Template Preview" /></a></li>
                                <li><a href="#"><img src="../image/data/images_1.jpg" width="938" height="209" alt="Css Template Preview" /></a></li>
                                <li><a href="#"><img src="../image/data/images_1.jpg"  width="938" height="209"alt="Css Template Preview" /></a></li>                                		
                            </ul>
        </div>
	  </div>       
  <?php if ($products) { ?>  
  <!--    
  <div class="product-grid">
    <?php foreach ($products as $product) { ?>
    <div>
      <?php if ($product['thumb']) { ?>
      <div class="image"><a href="<?php echo $product['href']; ?>"><img src="<?php echo $product['thumb']; ?>" title="<?php echo $product['name']; ?>" alt="<?php echo $product['name']; ?>" /></a></div>
      <?php } ?>
      <div class="name"><a style="<?php echo 'color:'.$color;?>" href="<?php echo $product['href']; ?>"><?php echo $product['name']; ?></a></div>
      <div class="description"><?php echo $product['description']; ?></div>
      <?php if ($product['price']) { ?>
      <div class="price">
        <?php if (!$product['special']) { ?>
        <?php echo $product['price']; ?>
        <?php } else { ?>
        <span class="price-old"><?php echo $product['price']; ?></span> <span class="price-new"><?php echo $product['special']; ?></span>
        <?php } ?>
        <?php if ($product['tax']) { ?>
        <br />
        <span class="price-tax"><?php echo $text_tax; ?> <?php echo $product['tax']; ?></span>
        <?php } ?>
      </div>
      <?php } ?>      
    </div>
    <?php } ?>
  </div>-->  
  <div class="box_center box_product box_danhmuc clearfix">											
	<div class="content clearfix" id="postswrapper">
    	<div class="with_109">
        <?php foreach ($products as $product):?>
        	<div class="items_danhmuc clearfix">
				<a href="<?php echo $product['href']?>" class="img_items_danhmuc clearfix">
				<img src="<?php echo $product['thumb']?>" width="218" height="207" />
				</a>
				<?php if($product['special'] && $product['price'] != 0 && $product['price'] > $product['special']):?>
	            	<span class="icon_down"><span class="text_ration"><?php echo ceil((($product['price']-$product['special'])/$product['price'])*100)."%";?></span></span>
	            <?php endif;?>                                   	
	            <h2 class="h2_items_danhmuc"><a style="<?php echo 'color:'.$color;?>" href="<?php echo $product['href']?>" class="name_items_danhmuc"><?php echo $product['name']?><br /><small>Bộ sưu tập đèn ngủ với lối thiết kế trang nhã nhẹ nhàng , dễ chịu </small></a></h2>
	            <?php if (!$product['special']):?>
	            	<span class="sp_price"><?php echo $product['price']?></span>
	            <?php else:?>
	                <span class="sp_price_off "><?php echo $product['price'];?></span>
					<span class="sp_price"><?php echo $product['special']?></span>
	            <?php endif;?>														
        	</div><!--end items_danhmuc-->                                                                 
        <?php endforeach;?>         
    	</div>    	  
	</div><!--end content-->
	<div><img id="loadmoreajaxloader" style="display:none" src="../catalog/view/theme/default/image/ajaxLoading.gif"/></div>	  
  </div><!--end box_product-->     
  <?php } ?>
  
  <?php if (!$categories && !$products) { ?>
  <br/><br/><br/><div class="content"><?php echo $text_empty; ?></div>  
  <?php } ?> 
      
  <?php endif;?>
  </div>
<?php echo $footer; ?>
<?php if($parent_id != 0):?>
<script type="text/javascript">
$(document).ready(function(){
	$("#slider").easySlider({
		auto: true,
		continuous: true,
		numeric: true 
	});
})
var page = 1;
var per_page = <?php echo $per_page;?>;
$(window).scroll(function()
{	
    if($(window).scrollTop() == $(document).height() - $(window).height())
    {
        page++;        
        if(page<(per_page +1)){
	        $('div#loadmoreajaxloader').show();
	        $.ajax({
	        url: 'index.php?route=product/category/load_ajax&path=<?php echo $path;?>&page='+page,
	        success: function(html)
	        {
	            if(html)
	            {
	                $("#postswrapper").append(html);
	                $('div#loadmoreajaxloader').hide();
	            }else
	            {
	                $('div#loadmoreajaxloader').html('<center>No more posts to show.</center>');
	            }
	        }
	        });  
        }      
    }
});
</script>
<?php endif;?>